//
//  SizeManager.m
//  MobileVLCKitDemo
//
//  Created by 金色榜样研发组 on 2019/5/30.
//  Copyright © 2019 Golden Bangyang (beijing) Cul Ture Media Investment Co. All rights reserved.
//

#import "SizeManager.h"

@implementation SizeManager

+ (FileSizeModel *)convertWithSize:(CGFloat)size
{
    
    NSArray *unitArr = @[@"bytes",@"KB",@"MB",@"GB",@"TB"];
    NSInteger i = 0;
    CGFloat currentFileSize = size * 1.0;
    while (currentFileSize > 1000) {
        currentFileSize = currentFileSize / 1000.0;
        i++;
    }
    NSString *unitString = @"bytes";
    if (i < unitArr.count) {
        unitString = unitArr[i];
    }
    
    
    FileSizeModel *model = [FileSizeModel new];
    model.sizeString = [NSString stringWithFormat:@"%.2lf %@",currentFileSize,unitString];
    model.size = currentFileSize;
    model.type = i;
    return model;
}

@end


@implementation FileSizeModel



@end
